﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="order_services.aspx.cs" Inherits="RastinArgham.CRM.Web.order_services" %>
<%@ Import Namespace="Mani.Common" %>
<%@ Register src="ContactInfo.ascx" tagname="ContactInfo" tagprefix="uc1" %>
<asp:Content ID="Constent1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3 class="ui-widget-header">
            <asp:Literal ID="lbtitle" runat="server" Text="لیست سرویس ها" />
    </h3>

    <div class="space2"></div>

    <uc1:ContactInfo ID="ContactInfo1" runat="server" />

    <div class="space2"></div>

    <div class="ui-layout-content ui-widget-content">
        <mani:PagingGridView ID="gvOrders" runat="server" AutoGenerateColumns="false" 
            GridLines="None" DataKeyNames="OrderId" AllowPaging="true" 
            PageSize="25" onrowcommand="gvOrders_RowCommand" 
            onrowdatabound="gvOrders_RowDataBound" >
            <Columns>
                <asp:BoundField HeaderText="کد" DataField="OrderId" />
                <asp:TemplateField HeaderText="عنوان شخص">
                    <ItemTemplate>
                        <a href='<%# Eval("ContactEditLink") %>'>
                            <%# Eval("ContactTitle") %>
                        </a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="سرویس" DataField="ServiceName" />
                <asp:TemplateField HeaderText="تاریخ شروع سرویس">
                    <ItemTemplate>
                        <%# Convert.ToDateTime(Eval("ServiceStartDate")).ToJalali()%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="تاریخ انقضای سرویس">
                    <ItemTemplate>
                        <%# Convert.ToDateTime(Eval("ServiceExpirationDate")).ToJalali()%>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="هزینه یک دوره سرویس">
                    <ItemTemplate>
                        <%# UIHelper.FormatString(Eval("Price")) %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="مدت یک دوره" DataField="ServicePeriod" />
                <asp:BoundField HeaderText="تعداد دوره درخواستی" DataField="Quantity" />
                <asp:TemplateField HeaderText="مالیات ( درصد )">
                    <ItemTemplate>
                         % <%# Eval("TaxPercent") %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="مبلغ کل ( ریال )">
                    <ItemTemplate>
                        <%# UIHelper.FormatString(Eval("TotalPrice")) %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="وضعیت" DataField="Status" />
                <asp:BoundField HeaderText="آخرین اپرتور" DataField="OperatorName" />
                
                <asp:TemplateField HeaderText="ویرایش">
                    <ItemTemplate>
                        <a href='order_services.aspx?&id=<%# Eval("ContactId") %>&OrderId=<%# Eval("OrderId") %>'>
                            <img src="/App_Themes/<%=Page.Theme %>/images/edit.gif" alt="" style="border:0;" />
                        </a>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="عملیات">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbLink1" Visible="false" runat="server" />
                        <asp:LinkButton ID="lbLink2" Visible="false" runat="server" />
                        <asp:LinkButton ID="lbLink3" Visible="false" runat="server" />
                        <asp:LinkButton ID="lbLink4" Visible="false" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
           </Columns>
        </mani:PagingGridView>

        <div class="space2"></div>

        <hr />
        
        <asp:Panel ID="pnlOrderProduct" runat="server">
            <h4 class="ui-widget-header">سفارش و ویرایش سرویس</h4>
        
            <div class="space2"></div>

            <table>
                <tr>
                    <td>کد سفارش</td>
                    <td>
                        <asp:TextBox ID="txtOrderId" ReadOnly="true" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>نوع سرویس</td>
                    <td>
                        <asp:DropDownList ID="ddlServices" runat="server" DataTextField="ServiceName"
                                          DataValueField="ServiceId" AppendDataBoundItems="true">
                                <asp:ListItem Text="---" Value="-1"></asp:ListItem>                   
                        </asp:DropDownList>

                        <asp:CompareValidator ID="cvServices" runat="server" ControlToValidate="ddlServices"
                                              ValueToCompare="-1" Operator="NotEqual" ValidationGroup="SubmitOrder" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>دوره سرویس</td>
                    <td>
                        <asp:DropDownList ID="ddlServicePeriod" runat="server">
                            <asp:ListItem Text="یک دوره" Value="1"></asp:ListItem>
                            <asp:ListItem Text="شش دوره" Value="6"></asp:ListItem>
                            <asp:ListItem Text="دوازده دوره" Value="12"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
               <tr>
                    <td>
                        تاریخ سفارش
                    </td>
                    <td>
                        <asp:TextBox ID="txtOrderDate" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>تاریخ شروع سرویس</td>
                    <td>
                        <asp:TextBox ID="txtServiceStartDate" runat="server" />
                    </td>
                </tr>
            </table>
            
            <table id="installationInfoTable" runat="server">
                <tr>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>شهر نصب : </td>
                    <td>
                        <asp:DropDownList ID="ddlInstallationCity" runat="server" DataTextField="CityName" DataValueField="CityId"></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        منطقه نصب : 
                    </td>
                    <td>
                        <asp:TextBox ID="txtInstallationRegion" MaxLength="10" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>آدرس نصب :</td>
                    <td>
                        <asp:TextBox ID="txtInstallationAddress" MaxLength="400" TextMode="MultiLine" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>نام ساختمان :</td>
                    <td>
                        <asp:TextBox ID="txtInstallationBuildingName" MaxLength="20" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>پلاک :</td>
                    <td>
                        <asp:TextBox ID="txtInstallationPlaque" MaxLength="20" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        طبقه :
                    </td>
                    <td>
                        <asp:TextBox ID="txtInstallationFloor" MaxLength="10" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>شماره واحد : </td>
                    <td>
                        <asp:TextBox ID="txtUnitNumber" MaxLength="10" runat="server"></asp:TextBox>
                    </td>
                </tr>
            </table>

            <table id="editOnlyTable" runat="server">
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>نصاب</td>
                    <td>
                        <asp:TextBox ID="txtInstaller" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>هزینه نصب</td>
                    <td>
                        <asp:DropDownList ID="ddlInstallationPrice" runat="server">
                            <asp:ListItem Text="---" Value="-1" />
                            <asp:ListItem Text="50000" Value="50000" />
                            <asp:ListItem Text="100000" Value="100000" />
                            <asp:ListItem Text="150000" Value="150000" />
                            <asp:ListItem Text="200000" Value="200000" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>فرم نصب</td>
                    <td>
                        <a id="aInstallationPhoto" class="bpopup" runat="server" visible="false">
                            <img id="imgInstallationPhoto" runat="server" alt="" src="" visible="false" style=" border:1px solid black; float: left;" />
                        </a>
                        <asp:FileUpload ID="fuInstallationPhoto" runat="server" />
                        <span class="note">حداکثر سایز مجاز تصویر 300 کیلوبایت می باشد</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr id="trFinalRefNum" runat="server">
                    <td>شناسه واریزی / شماره کارت</td>
                    <td>
                        <asp:TextBox ID="txtFinancialRefNum" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr id="trInvoiceNumber" runat="server">
                    <td>شماره فاکتور در نرم افزار فروش</td>
                    <td>
                        <asp:TextBox ID="txtInvoiceNumber" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr id="trCancelReason" runat="server">
                    <td>علت انصراف</td>
                    <td>
                        <asp:DropDownList ID="ddlCancelationReason" DataTextField="Description" DataValueField="Id" runat="server" AppendDataBoundItems="true">
                            <asp:ListItem Text="---" Value="-1" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
            </table>
            <table>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="btnSubmitOrder" ValidationGroup="SubmitOrder" runat="server" Text="ذخیره تغییرات" onclick="btnSubmitOrder_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
</asp:Content>
